/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.cw.bean;

import java.util.Date;

/**
 *
 * @author SVN - Team
 */
public class Reviews {

    private String estId;
    private Date date;
    private String typeOfMeal;
    private int overallRating;
    private int cost;
    private int rateOfAtmosphere;
    private int rateOfServices;
    private int rateOfFood;
    private String comment;

    public int getCost() {
        return cost;
    }

    public void setCost(int cost) {
        this.cost = cost;
    }

    public Date getDate() {
        return date;
    }

    public void setDate(Date date) {
        this.date = date;
    }

    public String getEstId() {
        return estId;
    }

    public void setEstId(String estId) {
        this.estId = estId;
    }

    public String getComment() {
        return comment;
    }

    public void setComment(String comment) {
        this.comment = comment;
    }

    public int getOverallRating() {
        return overallRating;
    }

    public void setOverallRating(int overallRating) {
        this.overallRating = overallRating;
    }

    public int getRateOfFood() {
        return rateOfFood;
    }

    public void setRateOfFood(int rateOfFood) {
        this.rateOfFood = rateOfFood;
    }

    public int getRateOfAtmosphere() {
        return rateOfAtmosphere;
    }

    public void setRateOfAtmosphere(int rateOfAtmosphere) {
        this.rateOfAtmosphere = rateOfAtmosphere;
    }
    
    public int getRateOfServices() {
        return rateOfServices;
    }

    public void setRateOfServices(int rateOfServices) {
        this.rateOfServices = rateOfServices;
    }

    public String getTypeOfMeal() {
        return typeOfMeal;
    }

    public void setTypeOfMeal(String typeOfMeal) {
        this.typeOfMeal = typeOfMeal;
    }

    public String toString() {
        return "estId=" + estId + "date=" + date + "typeOfMeal=" + typeOfMeal + "overallRating=" + overallRating + "cost=" + cost + "rateOfServices=" + rateOfServices + "rateOfFood=" + rateOfFood + "comment=" + comment;
    }

    public void convertByteToObject(byte[] byteObject) {
        String strData = new String(byteObject);
        estId = strData.substring(5, strData.indexOf("date="));
        String strDate = strData.substring(strData.indexOf("date=") + 5, strData.indexOf("typeOfMeal="));
        typeOfMeal = strData.substring(strData.indexOf("typeOfMeal=") + 11, strData.indexOf("overallRating="));
        overallRating = Integer.parseInt(strData.substring(strData.indexOf("overallRating=") + 14, strData.indexOf("cost=")));
        cost = Integer.parseInt(strData.substring(strData.indexOf("cost=") + 5, strData.indexOf("rateOfServices=")));
        rateOfServices = Integer.parseInt(strData.substring(strData.indexOf("rateOfServices=") + 15, strData.indexOf("rateOfFood=")));
        rateOfFood = Integer.parseInt(strData.substring(strData.indexOf("rateOfFood=") + 11, strData.indexOf("comment=")));
        comment = strData.substring(strData.indexOf("comment=") + 8);
    }
}
